package com.wdd.myplatform.consumerservice.controller;

import com.wdd.commmon.providerservice.entity.Goods;
import com.wdd.myplatform.consumerservice.feign.GoodsFeignService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/consumer")
@RefreshScope
public class DemoConsumerController {

    @Autowired
    private GoodsFeignService goodsFeignService;

    @GetMapping("/goods/{goodsId}")
    @ApiOperation("查询商品详情")
    public Goods getGoodsDetail(@PathVariable("goodsId") String goodsId){
        Goods goods = goodsFeignService.getGoodsDetail(goodsId);
        System.out.println(goods);
        return goods;
    }

}
